﻿@model  IEnumerable<Himall.Model.MemberGrade>
@{
    ViewBag.Title = "分类管理";
}
<script src="~/Scripts/CommonJS.js"></script>
<style type="text/css">
    .candel0{text-decoration:line-through;color:#808080; }
</style>

<div class="container">
    <ul class="nav nav-tabs-custom clearfix">
        <strong>会员等级</strong>
        <li class="active"><a>管理</a></li>
        <li><a href="./Add">新增</a></li>
        <em class="primary-btn">
            <span class="glyphicon glyphicon-question-sign"></span>
            <div class="primary">
                <h3>温馨提示：</h3>
                <span>*</span><p>会员等级</p>
            </div>
        </em>
    </ul>

    <table class="table category_table">
        <thead>
            <tr>
                <th>会员等级</th>
                <th>需要积分</th>
                <th width="500">备注</th>
                <th class="td-operate">操作</th>
            </tr>
        </thead>
        <tbody>
            @if (Model.Count() == 0)
            {
                <tr>
                    <td style="text-align:center;" colspan="4"><h2>没有添加任何会员等级</h2></td>
                </tr>
            }
            else
            {
                foreach (var grade in Model)
                {
                    <tr>
                        <td>@grade.GradeName</td>
                        <td>
                            @grade.Integral
                        </td>
                        <td>@grade.Remark</td>
                        <td class="td-operate">
                            <span class="btn-a"><a href="edit/@grade.Id">编辑</a></span>
                            <span class="btn-a"><a class="good-check candel@(grade.IsNoDelete?"0":"1")" onclick="DeleteGrade(this,@grade.Id,@(grade.IsNoDelete?"0":"1"))">删除</a></span>
                        </td>
                    </tr>
                }
            }
        </tbody>
    </table>
</div>
<script>
    function DeleteGrade(t,id,iscan)
    {
        if(iscan==1){
            var loading = showLoading();
            $.post("./Delete/" + id, function (data) {
                $.dialog.succeedTips(data.msg);
                $(t).parents("tr").remove();
                loading.close();
            });
        }else{
            $.dialog.errorTips("有礼品兑换与等级关联，不可删除！");
        }
    }
</script>

